using IBatisNet.Common;

using System.Text; 
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using Castle.MonoRail.Framework;

using eduSrc.Models;
using eduSrc.Services;

namespace eduSrc.Web.Controllers
{
    [Helper(typeof(FormatHelper))]
    [Layout("default")]
    public abstract class DefaultController : SmartController
    {
        protected readonly eduSrcCatalogService _eduSrcCatalogService = eduSrcCatalogService.GetInstance();

        protected void BindSearchChannel()
        {
            eduSrc.Models.ArticleType atc = new ArticleType();
            Dictionary<string, string> optionDic = atc.AtcCategoryShort;
            StringBuilder sb = new StringBuilder();
            foreach (KeyValuePair<string, string> item in atc.AtcCategoryShort)
            {
                string value = "/" + atc.GetArticleType(item.Key) + "/" + item.Key.Substring(2) + "/searchResult.rails";
                sb.AppendFormat("<option value=\"{0}\">{1}</option>", value, item.Value);
                sb.AppendLine();
            }
            PropertyBag["SearchType"] = sb.ToString();
        }
    }
}
